#include "widget.h"
#include "ui_widget.h"
#include <QPushButton>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    QPushButton* button = new QPushButton(this);
    button->setText("按钮");
    button->move(100,100);

    connect(button,&QPushButton::clicked,this,&Widget::handleclick);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handleclick()
{
    // 按下按钮标题会变成“按钮已按下”
    this->setWindowTitle("按钮已按下");
}

